package com.lzy.web;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lzy.entity.IM;
import com.lzy.service.MassiveQueryService;
import com.lzy.util.Page;
import com.lzy.util.PageRequest;

@Controller
@RequestMapping(value="/massiveQuery")
public class MassiveQueryController {
	
	private Logger log = LoggerFactory.getLogger(MassiveQueryController.class);
	
	private MassiveQueryService massiveQueryService ;
	
	@Autowired
	public void setMassiveQueryService(MassiveQueryService massiveQueryService) {
		this.massiveQueryService = massiveQueryService;
	}
	
	@RequestMapping(value="/index")
	public String index(){
		return "im/index";
	}
	
	@RequestMapping(value="/query")
	@ResponseBody
	public Page<IM> query(@RequestParam Map<Object,Object> params ,ModelMap model){
		
		log.info("查询开始");
		
		PageRequest pageRequest = new PageRequest();
		
		Page<IM> list = this.massiveQueryService.imChatList(params,pageRequest);
		
		log.info("查询结束");
		
		return list;
	}
	
}
